package com.xkdx.guangguang.fragment.user;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;

import com.xkdx.guangguang.module.network.AbsModule;

public class UserModifyPwdModule extends AbsModule {
	public ModifyUserPW user;
	JSONArray jsonArray;
	JSONObject jsonObj;

	public UserModifyPwdModule(Context context) {

	}

	@Override
	public void parseData() throws Exception {

		try {

			user = new ModifyUserPW();

			jsonArray = (JSONArray) result;
			jsonObj = (JSONObject) jsonArray.get(0);

			user = parserUserRgist(jsonObj.getJSONObject("Content"));
		} catch (Exception e) {
			// to do define a exception include all parseException
			throw e;
		}

	}

	private ModifyUserPW parserUserRgist(JSONObject userModifyPwd) throws Exception{

		try {
			JSONObject stut = userModifyPwd.getJSONObject("Result");

			if (stut.getString("ErrorCode") != null
					&& !"".equals(stut.getString("ErrorCode"))) {
				user.setErrorCode(stut.getString("ErrorCode"));
			} else {
				user.setErrorCode("");
			}
			user.setMessage(stut.getString("Message"));
			user.setType(stut.getString("Type"));
			user.setStatus(stut.getString("Status"));
		} catch (JSONException e) {
			throw e;
		}
		return user;

	}

	public class ModifyUserPW {
		private String Type;
		private String Status;
		private String ErrorCode;
		private String Message;

		public String getType() {
			return Type;
		}

		public void setType(String type) {
			Type = type;
		}

		public String getStatus() {
			return Status;
		}

		public void setStatus(String status) {
			Status = status;
		}

		public String getErrorCode() {
			return ErrorCode;
		}

		public void setErrorCode(String errorCode) {
			ErrorCode = errorCode;
		}

		public String getMessage() {
			return Message;
		}

		public void setMessage(String message) {
			Message = message;
		}
	}
}
